<?php 
include_once "checkRangeSchedulePerWorker.php";
include_once "getAccounts.php";
include_once "getAccount.php";


if(isset($_GET['shiftAction'])){
	switch ($_GET['shiftAction'])
	{
		case 'Delete Shift':
			include_once 'removeShift.php';
			$resultsRemoveShift = removeShift($userName, $userPassHash, $_GET['roleID'], $_GET['dateID'], $_GET['empID']);
			break;
	}
}


$viewDate;
if(isset($_GET['viewDate'])){
	$viewDate = $_GET['viewDate'];
}
else {
	$viewDate = date("Y-m-d");
}
$viewDate = strtotime($viewDate);


echo '<form action="template.php">';
echo '<input type="date" name="viewDate" value="'. date("Y-m-d", $viewDate) .'" />';
echo '<input type="submit" name="dateRange" value="View Surrounding Week" />';
echo '<input type="submit" name="dateRange" value="View Day" />';
echo '</form>';


$dateRange;
if (isset($_GET['dateRange']))
{
	$dateRange = $_GET['dateRange'];
	$_SESSION['dateRange'] = $dateRange;
}
elseif (isset($_SESSION['dateRange']))
{
	$dateRange = $_SESSION['dateRange'];
}
else
{
	$dateRange = "View Surrounding Week";
}

switch($dateRange){
	case "View Day":
		include_once "shiftManagerDaily.php";
		break;
	case "View Surrounding Week":
	default:
		include_once "shiftManagerWeekly.php";
		break;
}


// if(isset($_GET['dateRange'])){
// 	switch($_GET['dateRange'])
// 	{
// 		case 'View Surrounding Week':
// 			include_once "shiftManagerWeekly.php";
// 			break;
// 		case 'View Day':
// 			include_once "shiftManagerDaily.php";
// 			break;
// 	}
// }
// else {
// 	include_once "shiftManagerWeekly.php";
// }

?>